package com.aaa.system.controller;

import com.aaa.entity.User;
import com.aaa.system.service.UserService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author 崔灿
 * @Date 2023/02/27 09:12
 * @ClassName UserController
 * @Description
 * @Version 1.0
 */

@Api(value = "system/user", tags = {"用户控制"})
@RestController
@RequestMapping("system/user")
public class UserController {

    @Autowired
    private UserService userService;


    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "path", dataType = "string", name = "name", value = "", required = true)
    })
    @ApiOperation(value = "", notes = "", httpMethod = "GET")
    @GetMapping("/getByName/{name}")
    public User getByName(@PathVariable String name) {
        QueryWrapper<User> wrapper=new QueryWrapper<>();
        wrapper.eq("username",name);
        User user = userService.getOne(wrapper);
        return user;

    }

}
